package com.example.testscalaandroid2.act

import org.scaloid.common.SActivity
import org.scaloid.common.SVerticalLayout
import org.scaloid.common.STextView
import org.scaloid.common.SListView
import org.scaloid.common.SArrayAdapter
import org.scaloid.common._
import android.widget.ListView
class ListViewAct extends SActivity {
  onCreate {
    contentView = new SVerticalLayout {
      STextView("name")
      val s = (1 to 10).toArray.map { _.toString }
      val l = SListView().adapter(SArrayAdapter(s))
      l.choiceMode(ListView.CHOICE_MODE_SINGLE)
      l.onItemClick { (av, v, i, _) =>
        toast(s(i).toString)
        toast(v.toString)
      }
      SSpinner().prompt("what?").adapter(SArrayAdapter(s))
      .onItemSelected { (av, v, i, _) =>
        toast(s(i).toString)
        alert("title", "context", {
          info("alert now")
        })
        toast(v.toString)
      }
    }
  }
}

